package cn.czh0123.utils;

import lombok.Getter;

@Getter
public enum RedisKeys {

    WALLPAPER_STATISTICS("wallpaper_statistics", 60L * 60 * 4),
    WALLPAPER_OPERATE_RECORD("wallpaper_operate_record", 60L * 60 * 3),
    ;

    private final String prefix; //KEY的前缀
    private final Long time; //约定的时间 单位是秒

    RedisKeys(String prefix, Long time) {
        this.prefix = prefix;
        this.time = time;
    }

    /**
     * 拼接出完整的KEY
     */
    public String join(String... values) {
        StringBuilder sb = new StringBuilder(80);
        sb.append(this.prefix);
        for (String value : values) {
            sb.append(":").append(value);
        }
        return sb.toString();
    }

}